<!--{include(file='head.html')}-->
<script src="template/jslib/upload/ajaxupload.js" type="text/javascript"></script>
<div id="wrap">
	<!--{include('left.html')}-->
	<div id="maincont">
		<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
		<form action="<!--{url('admin','flink','picsave')}-->" method="post" name="submitform" id="submitform">
		<div id="main_c">
		<!--{if $opertype == "edit"}-->
			<ul class="bk">
				<li>
					<label><em>*</em>名称：</label>
					<p>
						<input class="input_tx" value="<!--{$pic.name}-->" name="name" id="name" type="text"/>
					</p>
				</li>
				<li>
					<label><em>*</em>广告标签：</label>
					<p>
						<select name="tag" id="tag">
							<option value="">请选择</option>
							<!--{$tagopt}-->
						</select>
						<a href="javascript:void(0);" onclick="addtag();return false;">添加广告标签</a>
					</p>
				</li>
				<li>
					<label><em>*</em>链接：</label>
					<p>
						<input class="input_tx" value="<!--{$pic.link}-->" name="link" id="link" type="text"/>
					</p>
				</li>
				<li id="forurl">
					<label><em>*</em>广告图片：</label>
					<p>
						<div id="buttonholder"></div>
						<input type="hidden" value="<!--{$pic.pic}-->" name="pic" id="pic"/>
					</p>
				</li>
				<li style="clear:both;">
					<label></label>
					<p id="uploadpic">
						<!--{if $pic.pic}-->
							<img src="<!--{$pic.pic}-->" />
						<!--{/if}-->
					</p>
				</li>
			</ul>
		<!--{elseif $opertype=="add"}-->
			<ul class="bk">
				<li>
					<label><em>*</em>名称：</label>
					<p>
						<input class="input_tx" value="" name="name" id="name" type="text"/>
					</p>
				</li>
				<li>
					<label><em>*</em>广告标签：</label>
					<p>
						<select name="tag" id="tag">
							<option value="">请选择</option>
							<!--{$tagopt}-->
						</select>
						<a href="javascript:void(0);" onclick="addtag();return false;">添加广告标签</a>
					</p>
				</li>
				<li>
					<label><em>*</em>链接：</label>
					<p>
						<input class="input_tx" value="http://" name="link" id="link" type="text"/>
					</p>
				</li>
				<li id="forurl">
					<label><em>*</em>广告图片：</label>
					<p>
						<div id="buttonholder"></div>
						<input type="hidden" value="" name="pic" id="pic"/>
					</p>
				</li>
				<li style="clear:both;">
					<label></label>
					<p id="uploadpic"></p>
				</li>
			</ul>
		<!--{/if}-->
			<div class="bt_bk2">
					<input type="hidden" value="<!--{$opertype}-->"		name="opertype" />
					<input type="hidden" value="<!--{def($picid)}-->"	name="picid" />
					<a href="javascript:;" class="btn" onclick="jssubmit('flink');return false;"><span>保存</span></a>
			</div>
		</div>
		</form>
		<b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b>
	</div>
</div>
<!--{include(file='foot.html')}-->
<script type="text/javascript">
$(function(){
	var uploader = new qq.FileUploader({action:"<!--{url('admin','uploadfile','pic')}-->"});
});
function addtag() {
	jPrompt("请输入广告标签（英文字母组合）","增加标签",function(val){
		if(!val){
			jAlert("请输入广告标签！");
			return false;
		}
		$tag = $("#tag");
		$tag[0].options.add(new Option(val,val));
		$tag.val(val);
	});
}
</script>